<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Flow: flow::log::Component Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Flow<span id="projectnumber">&#160;2.0.0</span>
   </div>
   <div id="projectbrief">Flow project: Full implementation reference.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceflow.html">flow</a></li><li class="navelem"><a class="el" href="namespaceflow_1_1log.html">log</a></li><li class="navelem"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="classflow_1_1log_1_1Component-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">flow::log::Component Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p>A light-weight class, each object storing a <em>component</em> payload encoding an <code>enum</code> value from <code>enum</code> type of user's choice, and a light-weight ID of that <code>enum</code> type itself.  
 <a href="classflow_1_1log_1_1Component.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="log_8hpp_source.html">log.hpp</a>&gt;</code></p>
<div class="dynheader">
Collaboration diagram for flow::log::Component:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component__coll__graph.svg" width="342" height="131"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-types" name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a287888e2943b312f4febc3e8e130fc80"><td class="memItemLeft" align="right" valign="top">using&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">enum_raw_t</a> = unsigned int</td></tr>
<tr class="memdesc:a287888e2943b312f4febc3e8e130fc80"><td class="mdescLeft">&#160;</td><td class="mdescRight">The type <code>Payload</code> must be <code>enum class Payload : enum_raw_t</code>: an <code>enum</code> type encoded via this integer type.  <a href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">More...</a><br /></td></tr>
<tr class="separator:a287888e2943b312f4febc3e8e130fc80"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a8c746035d0eea4a26d0982eabf63b713"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a8c746035d0eea4a26d0982eabf63b713">Component</a> ()</td></tr>
<tr class="memdesc:a8c746035d0eea4a26d0982eabf63b713"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> that stores no payload; meaning an unspecified-component <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> that returns <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>.  <a href="classflow_1_1log_1_1Component.html#a8c746035d0eea4a26d0982eabf63b713">More...</a><br /></td></tr>
<tr class="separator:a8c746035d0eea4a26d0982eabf63b713"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2dbca7a7e6b6c43c2119db1858c3b29d"><td class="memTemplParams" colspan="2">template&lt;typename Payload &gt; </td></tr>
<tr class="memitem:a2dbca7a7e6b6c43c2119db1858c3b29d"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a2dbca7a7e6b6c43c2119db1858c3b29d">Component</a> (Payload <a class="el" href="classflow_1_1log_1_1Component.html#a656f5868adbd8c58c493981fe1764699">payload</a>)</td></tr>
<tr class="memdesc:a2dbca7a7e6b6c43c2119db1858c3b29d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> with the given payload of arbitrary type, so long as that type is an <code>enum class : <a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80" title="The type Payload must be enum class Payload : enum_raw_t: an enum type encoded via this integer type.">Component::enum_raw_t</a></code>.  <a href="classflow_1_1log_1_1Component.html#a2dbca7a7e6b6c43c2119db1858c3b29d">More...</a><br /></td></tr>
<tr class="separator:a2dbca7a7e6b6c43c2119db1858c3b29d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5edb4c020c9de20e4c1c96c460b624e8"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a5edb4c020c9de20e4c1c96c460b624e8">Component</a> (const <a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;src)</td></tr>
<tr class="memdesc:a5edb4c020c9de20e4c1c96c460b624e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copies the source <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> into <code>*this</code>.  <a href="classflow_1_1log_1_1Component.html#a5edb4c020c9de20e4c1c96c460b624e8">More...</a><br /></td></tr>
<tr class="separator:a5edb4c020c9de20e4c1c96c460b624e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a325e56b14d7ce51ea4ee3cdfe6189490"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a325e56b14d7ce51ea4ee3cdfe6189490">Component</a> (<a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&amp;src_moved)</td></tr>
<tr class="memdesc:a325e56b14d7ce51ea4ee3cdfe6189490"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs <code>*this</code> equal to <code>src_moved</code>.  <a href="classflow_1_1log_1_1Component.html#a325e56b14d7ce51ea4ee3cdfe6189490">More...</a><br /></td></tr>
<tr class="separator:a325e56b14d7ce51ea4ee3cdfe6189490"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a146ce02cc7422b3a3bca07533536450e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a146ce02cc7422b3a3bca07533536450e">operator=</a> (const <a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;src)</td></tr>
<tr class="memdesc:a146ce02cc7422b3a3bca07533536450e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Overwrites <code>*this</code> with a copy of <code>src</code>.  <a href="classflow_1_1log_1_1Component.html#a146ce02cc7422b3a3bca07533536450e">More...</a><br /></td></tr>
<tr class="separator:a146ce02cc7422b3a3bca07533536450e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae0587562779694526b8dd1e8f7012494"><td class="memTemplParams" colspan="2">template&lt;typename Payload &gt; </td></tr>
<tr class="memitem:ae0587562779694526b8dd1e8f7012494"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#ae0587562779694526b8dd1e8f7012494">operator=</a> (Payload new_payload)</td></tr>
<tr class="memdesc:ae0587562779694526b8dd1e8f7012494"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code>operator=(<a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>&lt;Payload&gt;(new_payload))</code> modulo possibly minor perf differences.  <a href="classflow_1_1log_1_1Component.html#ae0587562779694526b8dd1e8f7012494">More...</a><br /></td></tr>
<tr class="separator:ae0587562779694526b8dd1e8f7012494"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a78dc45840c6fb12bd53784f7ea277ab4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a78dc45840c6fb12bd53784f7ea277ab4">operator=</a> (<a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&amp;src_moved)</td></tr>
<tr class="memdesc:a78dc45840c6fb12bd53784f7ea277ab4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Makes <code>*this</code> equal to <code>src_moved</code>.  <a href="classflow_1_1log_1_1Component.html#a78dc45840c6fb12bd53784f7ea277ab4">More...</a><br /></td></tr>
<tr class="separator:a78dc45840c6fb12bd53784f7ea277ab4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5af2f66731c407bd519a873706bd04c4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classbool.html">bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4">empty</a> () const</td></tr>
<tr class="memdesc:a5af2f66731c407bd519a873706bd04c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns <code>true</code> if <code>*this</code> is as if default-constructed (a null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>); <code>false</code> if as if constructed via the 1-arg constructor (a non-null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>).  <a href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4">More...</a><br /></td></tr>
<tr class="separator:a5af2f66731c407bd519a873706bd04c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a656f5868adbd8c58c493981fe1764699"><td class="memTemplParams" colspan="2">template&lt;typename Payload &gt; </td></tr>
<tr class="memitem:a656f5868adbd8c58c493981fe1764699"><td class="memTemplItemLeft" align="right" valign="top">Payload&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a656f5868adbd8c58c493981fe1764699">payload</a> () const</td></tr>
<tr class="memdesc:a656f5868adbd8c58c493981fe1764699"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns reference to immutable payload stored in <code>*this</code>; undefined behavior if <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>.  <a href="classflow_1_1log_1_1Component.html#a656f5868adbd8c58c493981fe1764699">More...</a><br /></td></tr>
<tr class="separator:a656f5868adbd8c58c493981fe1764699"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ff8ff4d75add447b3e10ded5430833d"><td class="memItemLeft" align="right" valign="top">const std::type_info &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a3ff8ff4d75add447b3e10ded5430833d">payload_type</a> () const</td></tr>
<tr class="memdesc:a3ff8ff4d75add447b3e10ded5430833d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns <code>typeid(Payload)</code>, where <code>Payload</code> was the template param used when calling the originating one-arg constructor or equivalent; undefined behavior if <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>.  <a href="classflow_1_1log_1_1Component.html#a3ff8ff4d75add447b3e10ded5430833d">More...</a><br /></td></tr>
<tr class="separator:a3ff8ff4d75add447b3e10ded5430833d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a899a7d2b0c5daa8e4d666d431b9bf48e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">enum_raw_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a899a7d2b0c5daa8e4d666d431b9bf48e">payload_enum_raw_value</a> () const</td></tr>
<tr class="memdesc:a899a7d2b0c5daa8e4d666d431b9bf48e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the numeric value of the <code>enum</code> payload stored by this <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>, originating in the one-arg constructor; undefined behavior if <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>.  <a href="classflow_1_1log_1_1Component.html#a899a7d2b0c5daa8e4d666d431b9bf48e">More...</a><br /></td></tr>
<tr class="separator:a899a7d2b0c5daa8e4d666d431b9bf48e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:a3c753f22e196c5f84718541ebb27dcac"><td class="memItemLeft" align="right" valign="top">std::type_info const  *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a3c753f22e196c5f84718541ebb27dcac">m_payload_type_or_null</a></td></tr>
<tr class="memdesc:a3c753f22e196c5f84718541ebb27dcac"><td class="mdescLeft">&#160;</td><td class="mdescRight">The <code>typeid()</code> of the <code>Payload</code> passed to the 1-arg constructor; if 0-arg ctor was used (<a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> is <code>true</code>) then it is null.  <a href="classflow_1_1log_1_1Component.html#a3c753f22e196c5f84718541ebb27dcac">More...</a><br /></td></tr>
<tr class="separator:a3c753f22e196c5f84718541ebb27dcac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5be216ad60f3e344a22151bdf4d8d8b6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">enum_raw_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classflow_1_1log_1_1Component.html#a5be216ad60f3e344a22151bdf4d8d8b6">m_payload_enum_raw_value</a></td></tr>
<tr class="memdesc:a5be216ad60f3e344a22151bdf4d8d8b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">The internally stored integer representation of the <code>enum</code> value passed to the 1-arg constructor; meaningless and ignored if 0-arg ctor was used (<a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> is <code>true</code>).  <a href="classflow_1_1log_1_1Component.html#a5be216ad60f3e344a22151bdf4d8d8b6">More...</a><br /></td></tr>
<tr class="separator:a5be216ad60f3e344a22151bdf4d8d8b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >A light-weight class, each object storing a <em>component</em> payload encoding an <code>enum</code> value from <code>enum</code> type of user's choice, and a light-weight ID of that <code>enum</code> type itself. </p>
<p >A <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> is supplied by the user, at every logging call site, along with the message. <a class="el" href="classflow_1_1log_1_1Log__context.html" title="Convenience class that simply stores a Logger and/or Component passed into a constructor; and returns...">Log_context</a> (or <a class="el" href="log_8hpp.html#ae4b5d4fdd2eb052615620879dd74af95" title="For the rest of the block within which this macro is instantiated, causes all FLOW_LOG_....">FLOW_LOG_SET_CONTEXT()</a> in relatively rare scenarios) makes this easier, so typically user need not literally type out a component at every logging call site, meaning there is a "context" that already stores it and need not be re-specified.</p>
<p >A <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> can be either empty, as when default-constructed, indicated by <a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> returning <code>true</code>; or non-empty, in which case it actually stores something interesting. In the latter case, construct it with the templated one-arg constructor. The template arg <code>Payload</code> must, always, be user's own <code>enum class</code>. In order to have this <code>Payload</code> interpreted correctly, one can (and usually should) use the <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a> facility which is used by out-of-the-box <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> implementations including <a class="el" href="classflow_1_1log_1_1Simple__ostream__logger.html" title="An implementation of Logger that logs messages to the given ostreams (e.g., cout or an ofstream for a...">Simple_ostream_logger</a> (useful for console output) and <a class="el" href="classflow_1_1log_1_1Async__file__logger.html" title="An implementation of Logger that logs messages to a given file-system path but never blocks any loggi...">Async_file_logger</a> (for heavy-duty file logging, including rotation support). However, this is technically optional: one can implement their own <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> which might not use the <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">Config</a> facility and thus deal with the meaning of <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> in some completely different way. I'd start with an existing <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> implementation however; and if writing one's own <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a>, then still have it use <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a>, unless that system is somehow insufficient or inappropriate.</p>
<p >Tip: Arguably the best way to see how to use all this together, just see <a class="el" href="namespaceflow.html#a3938730ab4b89daf13d027a5f620e7ce" title="The flow::log::Component payload enumeration comprising various log components used by Flow&#39;s own int...">flow::Flow_log_component</a> and how Flow's own code (which, itself, logs!) uses the log system. This is discussed in more detail in the class <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">Config</a> doc header. Lastly, some clarifying discussion may be found (as of this writing) in the Component::type_info() doc header.</p>
<h3>Thread safety, mutability</h3>
<p >A <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> is immutable as of this writing, except one can trivially overwrite a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> via an assignment operator. The latter write operation is not thread-safe w.r.t. a given <code>*this</code>, though in practice this is unlikely to ever matter.</p>
<h3>Implementation discussion</h3>
<p >Again &ndash; a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> conceptually must store only 2 things:</p><ul>
<li>Encoding of an <code>enum</code> value.</li>
<li>Some ID of the <code>enum class</code> type from which this value originates.</li>
</ul>
<p >Why these 2 values?</p><ul>
<li>When a <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> logs, it will likely want to print some string representation. If it's just printing an integer, then it needs that integer. If it's printing a string, it'll probably need to look up that string; for which it needs the ID of the per-logging-module component table, and of course the row within that table; as component 2 for module A is completely not the same component at all as component 2 for module B (and if it is, then it is a coincidence presumably).</li>
<li>When a <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> decides <em>whether</em> component C should indeed log message M (not even constructed yet at that point, for perf) at <a class="el" href="namespaceflow_1_1log.html#a5c602384e6fe9d7642740ac2fae4ad04" title="Enumeration containing one of several message severity levels, ordered from highest to lowest.">log::Sev</a> S, it must look up whether the logging of component C messages at severity S is indeed enabled at present. Some kind of data structure is required; for example a map (conceptually) from C to max severity S', to compare S vs. S'. <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a> (technically optional, though all out-of-the-box <code><a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a></code>s do use it), in particular, has such a structure.</li>
</ul>
<p >The operations required to implement, then, are:</p><ul>
<li>Construct a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> from an <code>enum class</code> value of arbitrary type (one such type per logging module).</li>
<li>Access the type ID of the latter type.</li>
<li>Access the <code>enum</code> value itself.</li>
</ul>
<p >The first version of <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> did this by simply storing (and thus being, in terms of data, equal to) <code>boost::any</code>. The constructor would simply load the <code>enum</code> value of type T as the <code>any</code> payload. The accessors would <code>any_cast&lt;T&gt;()</code> and then trivially access the value itself and/or its <code>typeid()</code>.</p>
<p >This was delightful in terms of code simplicity. However, due to the extreme prevalence of <a class="el" href="classflow_1_1log_1_1Logger.html#ac8a2e7a33fe3fbc0c29ead62ed98c022" title="Given attributes of a hypothetical message that would be logged, return true if that message should b...">Logger::should_log()</a> checks in code &ndash; at <em>every</em> log call site, including high-verbosity ones that do <em>not</em> typically result in messages being logged, such as for <a class="el" href="namespaceflow_1_1log.html#a5c602384e6fe9d7642740ac2fae4ad04a3ee808b04c34bf6c110e3754de277f7b" title="Message indicates any condition that may occur with great frequency (thus verbose if logged).">Sev::S_TRACE</a> &ndash; certain perf aspects of <code>boost::any</code> involved non-trivial perf costs. Namely:</p><ul>
<li><code>any</code> constructor performs a <code>new</code> when storing the arbitrarily-typed value, even though in our case it's always just an <code>enum</code>. Copying an <code>any</code> similarly will need to <code>new</code>.</li>
<li>The <code>any</code> accessors must do <code>virtual</code> lookups, to resolve to the particular <code>enum class</code> type.</li>
</ul>
<p >Hence the current solution optimized those issues away by making use of the fact we know the stored thing is <em>always</em> an <code>enum class</code>. Hence:</p><ul>
<li>Its value can be stored as an integer.</li>
<li>Its type can be stored directly; and since the type is an <code>enum</code>, which is non-polymorphic, the <code>typeid()</code> operation does not even need to do the <code>virtual</code> resolution. In fact its result is known at compile time. (This can even lead to further optimizations by the compiler.)</li>
</ul>
<p >Some discussion for perspective:</p><ul>
<li>Using <code>any</code> was elegant in terms of code simplicity; it is analogous to runtime dynamic typing of languages like Python.</li>
<li>It is just that it was too slow given the frequency of the accessor operations (and, to a lesser but still potentially significant degree &ndash; as with <a class="el" href="log_8hpp.html#ae4b5d4fdd2eb052615620879dd74af95" title="For the rest of the block within which this macro is instantiated, causes all FLOW_LOG_....">FLOW_LOG_SET_CONTEXT()</a> &ndash; for construction/copying).</li>
<li>Therefore it was replaced by a less-pithy hand-optimized solution that doesn't use Python-style dynamic typing but instead encodes the 2 bits of info directly by using the fact it's always an <code>enum</code>.</li>
<li>This does not mean <code>boost::any</code> is just too slow, because most operations are not done as frequently as should-log checks. It <em>does</em> mean it may be too slow in production in this <em>particular</em> context.<ul>
<li>It has been alleged that <code>std::any</code> (appearing first in C++17) in some or all gcc versions optimized-away these perf problems by storing certain values directly inside it, when those values were small enough to "fit." (Our <code>enum</code>s presumably would fit that bill, being glorified <code>int</code>s.) This is believable: Many <code>std::string</code> impls will directly store strings of sufficiently small length; e.g., &lt;=15 bytes would fit into the same area as the pointers and length data members required for arbitrarily-long string that do require heap allocation. Probably the same can be done for <code>any</code>. So keep that in mind if using <code>any</code> functionality in other contexts. </li>
</ul>
</li>
</ul>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l00839">839</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>
</div><h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a287888e2943b312f4febc3e8e130fc80" name="a287888e2943b312f4febc3e8e130fc80"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a287888e2943b312f4febc3e8e130fc80">&#9670;&nbsp;</a></span>enum_raw_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">using <a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">flow::log::Component::enum_raw_t</a> =  unsigned int</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The type <code>Payload</code> must be <code>enum class Payload : enum_raw_t</code>: an <code>enum</code> type encoded via this integer type. </p>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l00845">845</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a8c746035d0eea4a26d0982eabf63b713" name="a8c746035d0eea4a26d0982eabf63b713"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8c746035d0eea4a26d0982eabf63b713">&#9670;&nbsp;</a></span>Component() <span class="overload">[1/4]</span></h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">flow::log::Component::Component </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructs a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> that stores no payload; meaning an unspecified-component <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> that returns <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>. </p>
<p >Every <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> and all other systems must accept a message with such a null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>. However, one can configure a given <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> to ensure such messages not be logged (filtered out via <code>should_log()</code>). Point is, any log call site that supplied a null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> must still work, meaning not cause undefined behavior. </p>

<p class="definition">Definition at line <a class="el" href="log_8cpp_source.html#l00158">158</a> of file <a class="el" href="log_8cpp_source.html">log.cpp</a>.</p>

</div>
</div>
<a id="a2dbca7a7e6b6c43c2119db1858c3b29d" name="a2dbca7a7e6b6c43c2119db1858c3b29d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2dbca7a7e6b6c43c2119db1858c3b29d">&#9670;&nbsp;</a></span>Component() <span class="overload">[2/4]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Payload &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">flow::log::Component::Component </td>
          <td>(</td>
          <td class="paramtype">Payload&#160;</td>
          <td class="paramname"><em>payload</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructs a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> with the given payload of arbitrary type, so long as that type is an <code>enum class : <a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80" title="The type Payload must be enum class Payload : enum_raw_t: an enum type encoded via this integer type.">Component::enum_raw_t</a></code>. </p>
<p >(<a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80" title="The type Payload must be enum class Payload : enum_raw_t: an enum type encoded via this integer type.">enum_raw_t</a> is an unsigned integer type.) The resulting <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> will return <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == false</code>.</p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Payload</td><td>The type of the component value stored inside <code>*this</code>. This is required to be a type satisfying the requirements in the doc header for <a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80" title="The type Payload must be enum class Payload : enum_raw_t: an enum type encoded via this integer type.">enum_raw_t</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">payload</td><td>The payload value copied into <code>*this</code> and whenever a <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> itself is copied (or moved). </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l01720">1720</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>

<p class="reference">References <a class="el" href="classflow_1_1log_1_1Component.html#a146ce02cc7422b3a3bca07533536450e">operator=()</a>, and <a class="el" href="log_8hpp_source.html#l01727">payload()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a2dbca7a7e6b6c43c2119db1858c3b29d_cgraph.svg" width="339" height="107"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a5edb4c020c9de20e4c1c96c460b624e8" name="a5edb4c020c9de20e4c1c96c460b624e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5edb4c020c9de20e4c1c96c460b624e8">&#9670;&nbsp;</a></span>Component() <span class="overload">[3/4]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">flow::log::Component::Component </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&#160;</td>
          <td class="paramname"><em>src</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Copies the source <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> into <code>*this</code>. </p>
<p >This involves a single payload copy (and not even that if <code>src.empty()</code>).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Object to copy. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a325e56b14d7ce51ea4ee3cdfe6189490" name="a325e56b14d7ce51ea4ee3cdfe6189490"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a325e56b14d7ce51ea4ee3cdfe6189490">&#9670;&nbsp;</a></span>Component() <span class="overload">[4/4]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">flow::log::Component::Component </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&amp;&#160;</td>
          <td class="paramname"><em>src_moved</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructs <code>*this</code> equal to <code>src_moved</code>. </p>
<p >In this implementation it is equivalent to the copy constructor.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src_moved</td><td>Object to move. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a5af2f66731c407bd519a873706bd04c4" name="a5af2f66731c407bd519a873706bd04c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5af2f66731c407bd519a873706bd04c4">&#9670;&nbsp;</a></span>empty()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classbool.html">bool</a> flow::log::Component::empty </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns <code>true</code> if <code>*this</code> is as if default-constructed (a null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>); <code>false</code> if as if constructed via the 1-arg constructor (a non-null <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>). </p>
<dl class="section return"><dt>Returns</dt><dd>See above. </dd></dl>

<p class="definition">Definition at line <a class="el" href="log_8cpp_source.html#l00169">169</a> of file <a class="el" href="log_8cpp_source.html">log.cpp</a>.</p>

<p class="reference">References <a class="el" href="log_8hpp_source.html#l01017">m_payload_type_or_null</a>.</p>

<p class="reference">Referenced by <a class="el" href="config_8cpp_source.html#l00152">flow::log::Config::output_component_to_ostream()</a>, <a class="el" href="config_8cpp_source.html#l00184">flow::log::Config::output_whether_should_log()</a>, <a class="el" href="log_8cpp_source.html#l00180">payload_enum_raw_value()</a>, and <a class="el" href="log_8cpp_source.html#l00174">payload_type()</a>.</p>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a5af2f66731c407bd519a873706bd04c4_icgraph.svg" width="1203" height="292"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a78dc45840c6fb12bd53784f7ea277ab4" name="a78dc45840c6fb12bd53784f7ea277ab4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a78dc45840c6fb12bd53784f7ea277ab4">&#9670;&nbsp;</a></span>operator=() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp; flow::log::Component::operator= </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&amp;&#160;</td>
          <td class="paramname"><em>src_moved</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Makes <code>*this</code> equal to <code>src_moved</code>. </p>
<p >In this implementation it is equivalent to copy assignment. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src_moved</td><td>Object to move. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>*this</code>. </dd></dl>

</div>
</div>
<a id="a146ce02cc7422b3a3bca07533536450e" name="a146ce02cc7422b3a3bca07533536450e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a146ce02cc7422b3a3bca07533536450e">&#9670;&nbsp;</a></span>operator=() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp; flow::log::Component::operator= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp;&#160;</td>
          <td class="paramname"><em>src</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Overwrites <code>*this</code> with a copy of <code>src</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">src</td><td>Object to copy. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>*this</code>. </dd></dl>

<p class="reference">Referenced by <a class="el" href="log_8hpp_source.html#l01720">Component()</a>.</p>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a146ce02cc7422b3a3bca07533536450e_icgraph.svg" width="339" height="47"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="ae0587562779694526b8dd1e8f7012494" name="ae0587562779694526b8dd1e8f7012494"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae0587562779694526b8dd1e8f7012494">&#9670;&nbsp;</a></span>operator=() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Payload &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1log_1_1Component.html">Component</a> &amp; flow::log::Component::operator= </td>
          <td>(</td>
          <td class="paramtype">Payload&#160;</td>
          <td class="paramname"><em>new_payload</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Equivalent to <code>operator=(<a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>&lt;Payload&gt;(new_payload))</code> modulo possibly minor perf differences. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">new_payload</td><td>See non-default constructor. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>*this</code>. </dd></dl>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l01734">1734</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>

<p class="reference">References <a class="el" href="log_8hpp_source.html#l01023">m_payload_enum_raw_value</a>, and <a class="el" href="log_8hpp_source.html#l01017">m_payload_type_or_null</a>.</p>

</div>
</div>
<a id="a656f5868adbd8c58c493981fe1764699" name="a656f5868adbd8c58c493981fe1764699"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a656f5868adbd8c58c493981fe1764699">&#9670;&nbsp;</a></span>payload()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename Payload &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">Payload flow::log::Component::payload</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns reference to immutable payload stored in <code>*this</code>; undefined behavior if <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">Payload</td><td>See one-arg ctor doc header. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>See above. </dd></dl>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l01727">1727</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>

<p class="reference">References <a class="el" href="log_8hpp_source.html#l01023">m_payload_enum_raw_value</a>.</p>

<p class="reference">Referenced by <a class="el" href="log_8hpp_source.html#l01720">Component()</a>.</p>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a656f5868adbd8c58c493981fe1764699_icgraph.svg" width="339" height="47"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a899a7d2b0c5daa8e4d666d431b9bf48e" name="a899a7d2b0c5daa8e4d666d431b9bf48e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a899a7d2b0c5daa8e4d666d431b9bf48e">&#9670;&nbsp;</a></span>payload_enum_raw_value()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">Component::enum_raw_t</a> flow::log::Component::payload_enum_raw_value </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the numeric value of the <code>enum</code> payload stored by this <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a>, originating in the one-arg constructor; undefined behavior if <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>. </p>
<dl class="section return"><dt>Returns</dt><dd>See above. Specifically that's: <code>static_cast&lt;enum_raw_t&gt;(payload)</code>, where <code>payload</code> was passed to originating 1-arg ctor. </dd></dl>

<p class="definition">Definition at line <a class="el" href="log_8cpp_source.html#l00180">180</a> of file <a class="el" href="log_8cpp_source.html">log.cpp</a>.</p>

<p class="reference">References <a class="el" href="log_8cpp_source.html#l00169">empty()</a>, and <a class="el" href="log_8hpp_source.html#l01023">m_payload_enum_raw_value</a>.</p>

<p class="reference">Referenced by <a class="el" href="config_8cpp_source.html#l00040">flow::log::Config::component_to_union_idx()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a899a7d2b0c5daa8e4d666d431b9bf48e_cgraph.svg" width="370" height="47"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a899a7d2b0c5daa8e4d666d431b9bf48e_icgraph.svg" width="1015" height="254"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<a id="a3ff8ff4d75add447b3e10ded5430833d" name="a3ff8ff4d75add447b3e10ded5430833d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ff8ff4d75add447b3e10ded5430833d">&#9670;&nbsp;</a></span>payload_type()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const std::type_info &amp; flow::log::Component::payload_type </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns <code>typeid(Payload)</code>, where <code>Payload</code> was the template param used when calling the originating one-arg constructor or equivalent; undefined behavior if <code><a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> == true</code>. </p>
<p ><a class="el" href="namespaceflow_1_1log.html" title="Flow module providing logging functionality.">flow::log</a> user that relies fully on an out-of-the-box <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a>, or on a custom <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> that nevertheless fully uses the <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a> facility, is unlikely to need this information. (It is used internally by <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a>.) However, a custom <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> that decided to use an alternative <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> mechanism (as opposed to how <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a> and reliant <code><a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a></code>s do) can use this <a class="el" href="classflow_1_1log_1_1Component.html#a3ff8ff4d75add447b3e10ded5430833d" title="Returns typeid(Payload), where Payload was the template param used when calling the originating one-a...">payload_type()</a> method to distinguish between potential source <code>enum</code>s that were passed to the <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> at each given log call site.</p>
<p >For example, consider that Flow itself, for its own logging, uses the <a class="el" href="namespaceflow.html#a3938730ab4b89daf13d027a5f620e7ce" title="The flow::log::Component payload enumeration comprising various log components used by Flow&#39;s own int...">flow::Flow_log_component</a> <code>enum</code> at all log call sites. Imagine you, the user, have decided to generate your own <a class="el" href="namespaceflow_1_1log.html" title="Flow module providing logging functionality.">flow::log</a> messages and always use your own <code>enum class cool_project::Cool_log_component</code> at your own logging call sites. Then, a typical component specification will look like this respectively:</p>
<div class="fragment"><div class="line"><span class="keyword">class </span><a class="code hl_class" href="classflow_1_1net__flow_1_1Node.html">flow::net_flow::Node</a> : <span class="keyword">public</span> <a class="code hl_class" href="classflow_1_1log_1_1Log__context.html">Log_context</a></div>
<div class="line">{</div>
<div class="line">  Node(...) :</div>
<div class="line">    <a class="code hl_class" href="classflow_1_1log_1_1Log__context.html">Log_context</a>(..., <a class="code hl_enumeration" href="namespaceflow.html#a3938730ab4b89daf13d027a5f620e7ce">Flow_log_component</a>::S_NET_FLOW) <span class="comment">// This class will usually use the NET_FLOW component.</span></div>
<div class="line">    ...</div>
<div class="line"> </div>
<div class="line">class cool_project::Cool_class_about_widgets : public <a class="code hl_class" href="classflow_1_1log_1_1Log__context.html">Log_context</a></div>
<div class="line">{</div>
<div class="line">  Cool_class_about_widgets(...) :</div>
<div class="line">    <a class="code hl_class" href="classflow_1_1log_1_1Log__context.html">Log_context</a>(..., Cool_log_component::S_WIDGETRY) <span class="comment">// Ditto for your own code.  Use your own enum.</span></div>
<div class="ttc" id="aclassflow_1_1log_1_1Log__context_html"><div class="ttname"><a href="classflow_1_1log_1_1Log__context.html">flow::log::Log_context</a></div><div class="ttdoc">Convenience class that simply stores a Logger and/or Component passed into a constructor; and returns...</div><div class="ttdef"><b>Definition:</b> <a href="log_8hpp_source.html#l01609">log.hpp:1610</a></div></div>
<div class="ttc" id="aclassflow_1_1net__flow_1_1Node_html"><div class="ttname"><a href="classflow_1_1net__flow_1_1Node.html">flow::net_flow::Node</a></div><div class="ttdoc">An object of this class is a single Flow-protocol networking node, in the sense that: (1) it has a di...</div><div class="ttdef"><b>Definition:</b> <a href="node_8hpp_source.html#l00930">node.hpp:934</a></div></div>
<div class="ttc" id="anamespaceflow_html_a3938730ab4b89daf13d027a5f620e7ce"><div class="ttname"><a href="namespaceflow.html#a3938730ab4b89daf13d027a5f620e7ce">flow::Flow_log_component</a></div><div class="ttdeci">Flow_log_component</div><div class="ttdoc">The flow::log::Component payload enumeration comprising various log components used by Flow's own int...</div><div class="ttdef"><b>Definition:</b> <a href="common_8hpp_source.html#l00637">common.hpp:638</a></div></div>
</div><!-- fragment --><p >Now, <code>this-&gt;get_log_component().<a class="el" href="classflow_1_1log_1_1Component.html#a3ff8ff4d75add447b3e10ded5430833d" title="Returns typeid(Payload), where Payload was the template param used when calling the originating one-a...">payload_type()</a></code> will equal that of <code>Flow_log_component</code> and <code>Cool_log_component</code>, respectively, within those 2 classes. In particular, a custom <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> implementation can use <code><a class="el" href="classflow_1_1log_1_1Component.html#a3ff8ff4d75add447b3e10ded5430833d" title="Returns typeid(Payload), where Payload was the template param used when calling the originating one-a...">payload_type()</a></code> to interpret the <code><a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a></code>s of values from the 2 entirely disparate <code>enum</code>s in different ways. More in particular, the out-of-the-box <code><a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a></code>s use <code><a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">Config</a></code> to do all of that without your having to worry about it (but your own <a class="el" href="classflow_1_1log_1_1Logger.html" title="Interface that the user should implement, passing the implementing Logger into logging classes (Flow&#39;...">Logger</a> would potentially have to worry about it particularly if not using <a class="el" href="classflow_1_1log_1_1Config.html" title="Class used to configure the filtering and logging behavior of Loggers; its use in your custom Loggers...">log::Config</a>... though we suggest that you should, barring excellent design counter-reasons).</p>
<dl class="section return"><dt>Returns</dt><dd>See above. </dd></dl>

<p class="definition">Definition at line <a class="el" href="log_8cpp_source.html#l00174">174</a> of file <a class="el" href="log_8cpp_source.html">log.cpp</a>.</p>

<p class="reference">References <a class="el" href="log_8cpp_source.html#l00169">empty()</a>, and <a class="el" href="log_8hpp_source.html#l01017">m_payload_type_or_null</a>.</p>

<p class="reference">Referenced by <a class="el" href="config_8cpp_source.html#l00040">flow::log::Config::component_to_union_idx()</a>.</p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a3ff8ff4d75add447b3e10ded5430833d_cgraph.svg" width="339" height="47"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>
<div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="classflow_1_1log_1_1Component_a3ff8ff4d75add447b3e10ded5430833d_icgraph.svg" width="984" height="254"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</div>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a5be216ad60f3e344a22151bdf4d8d8b6" name="a5be216ad60f3e344a22151bdf4d8d8b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5be216ad60f3e344a22151bdf4d8d8b6">&#9670;&nbsp;</a></span>m_payload_enum_raw_value</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classflow_1_1log_1_1Component.html#a287888e2943b312f4febc3e8e130fc80">enum_raw_t</a> flow::log::Component::m_payload_enum_raw_value</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The internally stored integer representation of the <code>enum</code> value passed to the 1-arg constructor; meaningless and ignored if 0-arg ctor was used (<a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> is <code>true</code>). </p>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l01023">1023</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="log_8hpp_source.html#l01734">operator=()</a>, <a class="el" href="log_8hpp_source.html#l01727">payload()</a>, and <a class="el" href="log_8cpp_source.html#l00180">payload_enum_raw_value()</a>.</p>

</div>
</div>
<a id="a3c753f22e196c5f84718541ebb27dcac" name="a3c753f22e196c5f84718541ebb27dcac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c753f22e196c5f84718541ebb27dcac">&#9670;&nbsp;</a></span>m_payload_type_or_null</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::type_info const* flow::log::Component::m_payload_type_or_null</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The <code>typeid()</code> of the <code>Payload</code> passed to the 1-arg constructor; if 0-arg ctor was used (<a class="el" href="classflow_1_1log_1_1Component.html#a5af2f66731c407bd519a873706bd04c4" title="Returns true if *this is as if default-constructed (a null Component); false if as if constructed via...">empty()</a> is <code>true</code>) then it is null. </p>
<h3>Rationale</h3>
<p >Why is it a pointer and not something else? Answer: It cannot be a direct member: <code>type_info</code> is not copyable. It cannot be a non-<code>const</code> reference for the same reason. It cannot be a <code>const</code> reference, because <a class="el" href="classflow_1_1log_1_1Component.html" title="A light-weight class, each object storing a component payload encoding an enum value from enum type o...">Component</a> is mutable via assignment. Could use <code>reference_wrapper&lt;const type_info&gt;</code>, but ultimately that's the same as storing a pointer.</p>
<p >In any case by definition <code>type_info</code> is not copyable, and indeed the desire to store a "copy" is wrong-headed.</p>
<h3>Discussion of performance</h3>
<p >Careful: This does not mean that (for <code>type_info</code>s <code>A</code> and <code>B</code>) <code>A == B</code> only if <code>&amp;A == &amp;B</code>: two <code>type_info</code>s may be equal &ndash; refer to the same type &ndash; but be distinct objects. This occurs essentially only if the <code>A = typeid(...)</code> op was done on another side of a shared-object boundary versus the <code>B = typeid(...)</code> op.</p>
<p >(If they're <em>not</em> on opposing sides that way, then in fact <code>A == B</code> (if and) only if <code>&amp;A == &amp;B</code>. For example, if you've statically-linked all relevant code, then the relevant <code>type_info</code>s will be 1-1 with their addresses after all.)</p>
<p >That is why <code>type_index</code> (cted from a <code>type_info</code>) is useful for (essentially) storing <code>type_info</code>s in containers. Problem is: syntactically it's great; but it can give a false sense of performance: internally hashing, equality, and ordering ops cannot simply always assume <code>type_info*</code>s are 1-1 with distinct <code>type_info</code>s and hence usually STLs implement the hashing in terms of <code>type_info::name()</code> &ndash; a string, namely usually one containing the entire fully qualified type name (e.g.: some mangled version of <code>"flow::Log_component"</code>). Utilities in <a class="el" href="component__cfg_8hpp.html">detail/component_cfg.hpp</a> work with this topic. For more: start with <a class="el" href="classflow_1_1log_1_1Config.html#aab7de884a6d86042404dd1cb04691f02" title="Short-hand for fast-lookup map from distinct Component_payload type to the config for that component ...">Config::Component_payload_type_to_cfg_map</a> doc header. </p>

<p class="definition">Definition at line <a class="el" href="log_8hpp_source.html#l01017">1017</a> of file <a class="el" href="log_8hpp_source.html">log.hpp</a>.</p>

<p class="reference">Referenced by <a class="el" href="log_8cpp_source.html#l00169">empty()</a>, <a class="el" href="log_8hpp_source.html#l01734">operator=()</a>, and <a class="el" href="log_8cpp_source.html#l00174">payload_type()</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>log/<a class="el" href="log_8hpp_source.html">log.hpp</a></li>
<li>log/<a class="el" href="log_8cpp_source.html">log.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Mar 28 2025 22:55:35 for Flow by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
